<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
</head>
<body>
账号：<input id="username" value="" placeholder="请输入账号" type="text" ><br/>
密码：<input id="password" value="" placeholder="请输入密码" type="password"><br/>
<button id="login">登录</button>
<script>
   $("#login").click(function () {
        $.ajax({
            url: "/login",
            type: "POST",
            dataType: 'json',
            data: {
                User: $("#username").val(),
                Password: $("#password").val()
            },
            success: function (result) {
                alert(result)
                if (result == '登录成功') {
                    window.open('/index', '_self')
                }
            },
            error: function () {
                console.log('shibai')
            },
        });
    })
</script>
</body>
</html>